<template>
  <view style="margin-bottom: 10px;" class="card">
    <nut-space direction="vertical">
      <view style="display: flex;justify-content: space-between">
        <nut-space>
          <!--商品类型-->
          <nut-tag type="primary" v-if="data.publishType=='DEMAND'"> 需求商品</nut-tag>
          <nut-tag type="success" v-if="data.publishType=='IDLE'"> 闲置商品</nut-tag>
          <!-- 状态-->
          <view v-if="data.auditStatus == 'SUCCESS'">
            <nut-tag color="#2ECC71" text-color="#2ECC71" plain>审核成功</nut-tag>
          </view>
          <view v-if="data.auditStatus == 'REJECT'">
            <nut-space align="end">
              <nut-tag color="#E74C3C" text-color="#E74C3C" plain>已驳回</nut-tag>
              <IconFont name="ask"  size="15" color="#E74C3C" @click.stop="emit('rejectReason',data)"/>
            </nut-space>

          </view>
          <view v-if="data.auditStatus == 'AUDIT'">
            <nut-tag color="#3498DB" text-color="#3498DB" plain>审核中</nut-tag>
          </view>
        </nut-space>
        <nut-space>
          <nut-tag v-if="data.auditStatus == 'REJECT'" color="#2ECC71" text-color="#fff" @click.stop="emit('audit',data)">
            提交审核
          </nut-tag>
          <IconFont color="#1677ff" name="edit" size="15" @click.stop="emit('edit',data)"></IconFont>

          <IconFont
              size="16"
              name="del"
              color="red"
              @click.stop="clickDelete"
          ></IconFont>
        </nut-space>


      </view>
      <view class="title-box single-line-text" style="width: 300px">
        {{ data.name }}
      </view>

      <view class="content-box single-line-text">
        联系人员： {{ data.contactName }}
      </view>

      <view class="content-box single-line-text">
        联系电话：{{ data.contactPhone }}
      </view>

      <view class="content-box single-line-text">
        联系地址：{{ data.contactAddr }}
      </view>
      <view class="content-box single-line-text">
        发布时间：{{ data.createTime }}
      </view>
    </nut-space>
  </view>
</template>
<script setup>
import {defineEmits} from 'vue';

const emit = defineEmits(['sureDelete', 'edit',"rejectReason","audit"]);

import {IconFont} from "@nutui/icons-vue";

const props = defineProps({
  data: {
    type: Object,
    default: {}
  }
});

const clickDelete = () => {
  emit('sureDelete', props.data);

}

</script>


<style>

.title-box {
  width: 620px;
  font-size: 28px;
}

.content-box {
  width: 620px;
  font-size: 22px;
  color: #636363;
}

</style>